<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">出库任务编码</label>
        <el-input v-model.trim="query.otherOutboundTaskCode" clearable placeholder="出库任务编码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" @clear="crud.toQuery" />
        <!-- <label class="el-form-item-label">任务类型</label>
        <el-input v-model="query.taskType" clearable placeholder="任务类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> -->
        <label class="el-form-item-label">任务状态</label>
        <el-select v-model="query.status" class="filter-item" clearable placeholder="请选择" style="width: 185px;" @change="crud.toQuery">
          <el-option
            v-for="item in dict.allOrder_status"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation :crud="crud" />
      </div>
      <crudOperation :permission="permission" />
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <!-- <el-table-column type="selection" width="55" /> -->
        <el-table-column prop="otherOutboundTaskCode" label="出库任务编码" />
        <el-table-column prop="taskType" label="任务类型">
          <template slot-scope="scope">
            <!-- {{ dict.label.XXX[scope.row.taskType] }} -->{{ scope.row.taskType }}
          </template>
        </el-table-column>
        <el-table-column prop="status" label="任务状态">
          <template slot-scope="scope">
            {{ dict.label.allOrder_status[scope.row.status] }}
          </template>
        </el-table-column>
        <el-table-column prop="taskStart" label="任务起点" />
        <el-table-column prop="taskEnd" label="任务终点" />
        <el-table-column prop="priority" label="优先级" />
        <el-table-column prop="finishTime" label="完成时间" />
        <el-table-column prop="parentPalletCode" label="母托编码" />
        <el-table-column prop="sources" label="来源" />
        <el-table-column prop="sourcesId" label="来源id (出库单的id)" />
        <el-table-column prop="qty" label="母托上的物料数量" />
        <el-table-column prop="otherOutboundOrderNo" label="出库单号" />
        <el-table-column prop="bandingType" label="包装类型" />
        <el-table-column prop="wrappingQty" label="包装数量" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column prop="updateTime" label="更新时间" />
        <!-- <el-table-column v-if="checkPer(['admin','otherOutboundTaskHistory:edit','otherOutboundTaskHistory:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column> -->
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudOtherOutboundTaskHistory from '@/api/work/otheroutboundMissionHistory'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
// import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, otherOutboundTaskCode: null, taskType: null, status: null, taskStart: null, taskEnd: null, priority: null, finishTime: null, parentPalletCode: null, sources: null, sourcesId: null, qty: null, otherOutboundOrderNo: null, bandingType: null, wrappingQty: null, createTime: null, updateTime: null, createName: null, updateName: null }
export default {
  name: 'OtheroutboundMissionHistory',
  components: { pagination, rrOperation, crudOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: ['allOrder_status'],
  cruds() {
    return CRUD({ title: '1', url: 'api/otherOutboundTaskHistory', idField: 'id', sort: 'id,desc', crudMethod: { ...crudOtherOutboundTaskHistory },
      optShow: {
        reset: true,
        add: false,
        del: false,
        edit: false,
        download: true
      }
    })
  },
  data() {
    return {
      permission: {
        add: ['admin', 'otherOutboundTaskHistory:add', 'otherUser'],
        edit: ['admin', 'otherOutboundTaskHistory:edit', 'otherUser'],
        del: ['admin', 'otherOutboundTaskHistory:del', 'otherUser']
      },
      rules: {
      },
      queryTypeOptions: [
        { key: 'otherOutboundTaskCode', display_name: '出库任务编码' },
        { key: 'taskType', display_name: '任务类型' }
      ]
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
